package com.example.skycode5.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
    private String FileName;
    public int DBPort;
    public Connection conn;
    public String MySQLDriver;
    public String MySQLURL;
    public DBConnection(){
        conn = null;
    }
    public Connection getConn(){
        int DBType = 1;
        switch (DBType){
            case 1:
                return (getConnToMySQL());
            default:
                return null;
        }
    }
    public Connection getConnToMySQL(){
        try {
            MySQLDriver="com.mysql.cj.jdbc.Driver";
            MySQLURL="jdbc:mysql://localhost:3306/sky5?user=root&password=bzxbzxbzx821&useUnicode=true&characterEncoding=utf8";
            Class.forName(MySQLDriver).newInstance();
            conn = DriverManager.getConnection(MySQLURL);
        }catch (Exception e){
            e.printStackTrace();
        }
        return conn;
    }
    
}
